<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:bm="http://localhost:8080/customTags"
                template="layout/template.xhtml">


    <ui:define name="windowTitle">
        #{stock.products}
    </ui:define>s

    <ui:define name="content" id="content">
        <h:form>
            <script type="text/javascript">
                var row;
            </script>

            <a4j:region>
                <rich:dataTable id="table" value="#{clients.list}"
                                var="dataItem" rowClasses="row1, row2" rows="10" rowKeyVar="row"
                                ajaxKeys="#{clients.keys}" onRowMouseOver="this.style.backgroundColor='#B5F3FB'"
                                onRowMouseOut="this.style.backgroundColor='#{a4jSkin.rowBackgroundColor}'" width="100%">

                    <f:facet name="header">
                        <h:outputText value="Client Listing" />
                    </f:facet>


                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="ID" />
                        </f:facet>
                        <h:outputText value="#{dataItem.id}" id="id" />
                    </rich:column>


                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="ID" />
                        </f:facet>
                        <h:outputText value="#{dataItem.profile.fullName}" id="fullName" />
                    </rich:column>



                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Home Address" />
                        </f:facet>
                        <h:outputText value="#{dataItem.profile.homeAddress}" id="homeAddress" />
                    </rich:column>

                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Join Date" />
                        </f:facet>
                        <h:outputText value="#{dataItem.profile.joinDate}" id="joinDate" />
                    </rich:column>


                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Occupation" />
                        </f:facet>
                        <h:outputText value="#{dataItem.profile.occupation}" id="occupation" />
                    </rich:column>


                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Solvability" />
                        </f:facet>
                        <h:outputText value="#{dataItem.solvability}" id="solvability" />
                    </rich:column>


                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Email" />
                        </f:facet>
                        <h:outputText value="#{dataItem.contact.email}" id="email" />
                    </rich:column>


                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="ID" />
                        </f:facet>
                        <h:outputText value="#{dataItem.contact.mobile}" id="id" />
                    </rich:column>


                    <rich:column>
                        <f:facet name="header">
                            Actions
                        </f:facet>
                        <a4j:commandLink ajaxSingle="true" id="editlink"
                                         oncomplete="#{rich:component('editPanel')}.show()">
                            <h:graphicImage value="/images/icons/edit.gif" style="border:0" />
                            <f:setPropertyActionListener value="#{dataItem}"
                                                         target="#{product.product}" />
                            <f:setPropertyActionListener value="#{row}"
                                                         target="#{products.currentRow}" />
                        </a4j:commandLink>
                        <rich:toolTip for="editlink" value="Edit" />
                        <a4j:commandLink ajaxSingle="true" id="deletelink"
                                         oncomplete="#{rich:component('deletePanel')}.show()">
                            <h:graphicImage value="/images/icons/delete.gif" style="border:0" />
                            <f:setPropertyActionListener value="#{row}"
                                                         target="#{products.currentRow}" />
                        </a4j:commandLink>
                        <rich:toolTip for="deletelink" value="Delete" />
                        <a4j:commandLink ajaxSingle="true" id="copylink"
                                         oncomplete="#{rich:component('editPanel')}.show()">
                            <h:graphicImage value="/images/icons/edit.gif" style="border:0" />
                            <f:setPropertyActionListener value="#{dataItem}"
                                                         target="#{product.product}" />
                            <f:setPropertyActionListener value="#{0}"
                                                         target="#{product.product.id}" />
                        </a4j:commandLink>
                        <rich:toolTip for="copylink" value="Copy" />
                    </rich:column>
                    <f:facet name="footer">
                        <rich:datascroller renderIfSinglePage="false" maxPages="5" />
                    </f:facet>

                </rich:dataTable>
            </a4j:region>
        </h:form>

        <a4j:status onstart="#{rich:component('wait')}.show()"
                    onstop="#{rich:component('wait')}.hide()" />
        <rich:modalPanel id="wait" autosized="true" width="200" height="120"
                         moveable="false" resizeable="false">
            <f:facet name="header">
                <h:outputText value="Processing" />
            </f:facet>
            <h:outputText value="Wait Please..." />
        </rich:modalPanel>
    </ui:define>
</ui:composition>
